package com.example.owner.bean.impl;

import com.example.owner.bean.Engine;
import io.micronaut.context.annotation.Bean;
import io.micronaut.context.annotation.Context;
import io.micronaut.context.annotation.Primary;
import jakarta.annotation.PreDestroy;
import jakarta.inject.Singleton;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Context //  和Application 一块创建
@Bean(preDestroy = "destroy")
public class V10Engine implements Engine {  // (2)

    public V10Engine() {
        log.info("Engine >> V10Engine init");
    }
    @Override
    public String start() {
        return "Starting V8";
    }

    @Override
    public int getCylinders() {
        return 8;
    }


    @PreDestroy
    public void destroy() {
        log.info("Engine >> V10Engine destroy");
    }

}